home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-15 | 656 b | 37 lines | [TEXT/CWIE] |
- // STL3.cp
- #include <iostream>
- #include <list>
- using namespace std;
- int main()
- {
- typedef list<char> MyList;
- char start[] = "machack";
- MyList l(start, start + strlen(start));
-
- ostream_iterator<char> out(cout);
- cout << " start: ";
- copy(l.begin(), l.end(), out);
-
- cout << "\nremoved: ";
- l.remove('c');
- copy(l.begin(), l.end(), out);
-
- cout << "\n sorted: ";
- l.sort();
- copy(l.begin(), l.end(), out);
-
- cout << "\n unique: ";
- l.unique();
- copy(l.begin(), l.end(), out);
-
- cout << "\nreverse: ";
- l.reverse();
- copy(l.begin(), l.end(), out);
- cout << "\n";
- }
- // start: machack
- // removed: mahak
- // sorted: aahkm
- // unique: ahkm
- // reverse: mkha
-